
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
      var form = layui.form,layer = layui.layer;
      //监听提交
      form.on('submit(add)', function(data){
        	$.post("changePasswords.do",{id:$("#pId").val(),aUsername:data.field.username,aPassword:data.field.pass},function(res){
       		if(res.type==1){
       			layer.alert("修改成功", {icon: 6},function () {
                    // 获得frame索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭当前frame
                    parent.layer.close(index);
                    window.location.reload();
                }); 
       		}else{
                window.location.reload();
       			layer.msg(data.msg, {area:['300px', '200px']}); 
       		}
       	},"json")
       	return false;
      });
      
      
    });
    $(function(){
    	if($("#pId").val()=="null"){
    		$("#updataIdName").html("个人密码修改")
    	}
    })
    